<template>
  <el-dialog
    v-el-drag-dialog
    :title="dataForm.id ? '' : ''"
    :close-on-click-modal="false"
    :visible.sync="visible"
    width="60%">
    <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="130px">
      <span style="font-size:16px">买家信息</span><hr>
       <el-row :gutter="20">
         <el-col :span="10">
           <el-form-item label="店铺头像:">
               <el-popover
                 placement="right"
                 title=""
                 trigger="hover">
                 <img class="image1" :src="'http://image.yilianbaihui.cn/consumer/'+ dataForm.path"/>
                 <img slot="reference" :src="'http://image.yilianbaihui.cn/consumer/' + dataForm.path " style="height: 60px;width: 60px; border-radius:200px;margin-top: 10px">
               </el-popover>
           </el-form-item>
         </el-col>
         <el-col :span="10">
           <el-form-item label="店铺名称:">
             <span>{{dataForm.businessTrueName}}</span>
           </el-form-item>
         </el-col>
      </el-row>
      <span style="font-size:16px">配送信息</span><hr>
      <el-row :gutter="20">
        <el-col :span="10">
          <el-form-item label="配送费:">
            <span v-if="dataForm.deliverMoney !== null">￥ {{dataForm.deliverMoney}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="取货地址:">
            <span>{{dataForm.addressText}}</span>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="10">
          <el-form-item label="联系人:">
            <span>{{dataForm.businessRealName}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="联系电话:">
            <span>{{dataForm.storeIphone}}</span>
          </el-form-item>
        </el-col>
      </el-row>
      <!--<el-row :gutter="20">
        <el-col :span="10">
          <el-form-item label="订单来源:">
            <span>{{dataForm.trueName}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="10">
        </el-col>
      </el-row>-->
      <span style="font-size:16px">订单信息</span><hr>
      <el-row :gutter="20">
        <el-col :span="10">
          <el-form-item label="订单号:">
            <span>{{dataForm.foreignOrderNo}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="订单时间:">
            <span>{{dataForm.createTime}}</span>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="10">
          <el-form-item label="支付方式:">
            <label v-if="dataForm.payStatus === 0">余额支付</label>
          </el-form-item>
        </el-col>
        <el-col :span="10">
        </el-col>
      </el-row>
      <span style="font-size:16px">接单信息</span><hr>
      <el-row :gutter="20">
        <el-col :span="10">
          <el-form-item label="配送骑手:">
            <span>{{dataForm.riderUserRealName}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="骑手电话:">
            <span>{{dataForm.riderUserMobilePhone}}</span>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="10">
          <el-form-item label="开始服务时间:">
            <span>{{dataForm.startTime}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="完成服务时间:">
            <span>{{dataForm.sucessTime}}</span>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button type="primary" @click="visible = false">确定</el-button>
    </span>
  </el-dialog>
</template>

<script>
  export default {
    data () {
      return {
        visible: false,
        dataForm: {
          id: 0,
          path: '',
          businessTrueName: '',
          businessRealName: '',
          deliverMoney: '',
          addressText: '',
          storeIphone: '',
          foreignOrderNo: '',
          createTime: '',
          payStatus: '',
          riderUserRealName: '',
          riderUserMobilePhone: '',
          startTime: '',
          sucessTime: ''
        }
      }
    },
    methods: {
      init (id) {
        debugger
        this.dataForm.id = id || 0
        this.visible = true
        this.$nextTick(() => {
          if (this.dataForm.id) {
            debugger
            this.$http({
              url: this.$http.adornUrl(`/external/queryExternalOrderById/${this.dataForm.id}`),
              method: 'get',
              params: this.$http.adornParams()
            }).then(({data}) => {
              if (data && data.code === 0) {
                this.dataForm.path = data.data.path
                this.dataForm.businessTrueName = data.data.businessTrueName
                this.dataForm.businessRealName = data.data.businessRealName
                this.dataForm.deliverMoney = data.data.deliverMoney
                this.dataForm.addressText = data.data.addressText
                this.dataForm.storeIphone = data.data.storeIphone
                this.dataForm.foreignOrderNo = data.data.foreignOrderNo
                this.dataForm.createTime = data.data.createTime
                this.dataForm.payStatus = data.data.payStatus
                this.dataForm.riderUserRealName = data.data.riderUserRealName
                this.dataForm.riderUserMobilePhone = data.data.riderUserMobilePhone
                this.dataForm.startTime = data.data.startTime
                this.dataForm.sucessTime = data.data.sucessTime
              }
            })
          }
        })
      }
    }
  }
</script>
